package com.squareshoot.picCheckin;

import android.app.Activity;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;

public class NotificationsClick extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		Log.d(Common.SERVICE_TAG,"NotificationsIntent onCreate()");
		Bundle bundle  = getIntent().getExtras();
		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
		
		int number = prefs.getInt("countPhotos",-1);
		if(Common.HIGHDEBUG)
			Log.d(Common.SERVICE_TAG,number+" new photos");
		
		NotificationManager myNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
		myNotificationManager.cancelAll();
		prefs.edit().putInt("countPhotos",0).commit();
		
		Intent i = new Intent();
		i.putExtras(bundle);
		
		if(number==1){
			i.setClass(this,FullscreenPicture.class);
		}else if(number>1){
			//Lancer timeline amis
			i.setClass(this,FriendsTimeline.class);
		}else{ //erreur number==-1
			
		}
		startActivity(i);
		finish();
	}
	
}